{% extends 'base.html' %}
{% block title %}更新员工{% endblock %}
{% block content %}
<div class="container" style="background-color: #fff0f5; padding: 20px; border-radius: 10px;">
  <div class="panel panel-default" style="border: none;">
    <div class="panel-heading" style="background-color: #ff6b81; color: white; font-size: 18px; border-radius: 5px 5px 0 0;">
      更新员工 {{ emp.dept_id }}
    </div>
    <div class="panel-body">
      <form method="post">
        {% csrf_token %}
        <div class="form-group">
          <label for="empno">员工编号</label>
          <input type="text" id="empno" name="empno" value="{{ emp.empno }}" class="form-control" readonly style="border-radius: 5px;"/>
        </div>
        <div class="form-group">
          <label for="ename">员工姓名</label>
          <input type="text" id="ename" name="ename" value="{{ emp.ename }}" class="form-control" style="border-radius: 5px;"/>
        </div>
        <div class="form-group">
          <label for="sal">工资</label>
          <input type="text" id="sal" name="sal" value="{{ emp.sal }}" class="form-control" style="border-radius: 5px;"/>
        </div>
        <div class="form-group">
          <label for="hiredate">雇佣日期</label>
          <input type="text" id="hiredate" name="hiredate" value="{{ emp.hiredate|date:'Y-m-d' }}" class="form-control" style="border-radius: 5px;"/>
        </div>
        <div class="form-group">
          <label for="deptno">部门</label>
          <select name="deptno" id="deptno" class="form-control" style="border-radius: 5px;">
            <option value="">--请选择--</option>
            {% for dept in dept_list %}
              {% if dept.deptno == emp.dept_id %}
                <option value="{{ dept.deptno }}" selected>{{ dept.dname }}</option>
              {% else %}
                <option value="{{ dept.deptno }}">{{ dept.dname }}</option>
              {% endif %}
            {% endfor %}
          </select>
        </div>
        <button class="btn btn-primary" style="background-color: #ff6b81; border: none; padding: 10px 20px; font-size: 16px; border-radius: 5px;">修改</button>
      </form>
    </div>
  </div>
</div>
{% endblock %}
{% block js %}
<script type="text/javascript">
  $(function(){
    $("#hiredate").datepicker({
      format: 'yyyy-mm-dd',
      language: 'zh-CN',
      autoclose: true,
      todayHighlight: true,
      todayBtn: true
    });
  });
</script>
{% endblock %}
